
package sg.edu.nus.iss.cats.dataaccess.mysql;

import sg.edu.nus.iss.cats.model.*;
import sg.edu.nus.iss.cats.dataaccess.*;
import java.sql.*;

public class EmployeeObjectHandler implements ObjectHandler {

    public String getTableName () {
        return DBConstants.employeesTableName;
    }

    public String getKeyParameterConstraint () {
        return DBConstants.e_employeeId + "=?";
    }

    public void setKeyParameters (PreparedStatement statement, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method setKeyValues not implemented");
    }

    public Object retrieveObject (ResultSet results)
                   throws SQLException, DAOException {
        Employee obj = new Employee ();
        obj.setEmployeeId (results.getString(DBConstants.e_employeeId));
        obj.setName (results.getString(DBConstants.e_name));
        obj.setManagerId (results.getString(DBConstants.e_managerId));
        return obj;
    }

    public void insertKeys (ResultSet results, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method insertKey not implemented");
    }

    public void updateObject (ResultSet results, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method updateObject not implemented");
    }

    public void completeObjectRetrieve (Object obj) throws DAOException {
    }

    public Object[] getObjectArray (int length) {
        return new Employee [length];
    }
}